local skel = fk.CreateSkill {
  name = "lb_old__shuofeng",
}

Fk:loadTranslationTable {
  ["lb_old__shuofeng"] = "朔风",
  [":lb_old__shuofeng"] = "准备阶段，你可以令一名角色选择一项：<br>" ..
      "1.本回合不能使用【闪】，你本回合可以重铸【闪】；<br>" ..
      "2.本轮不能使用【杀】。",

  ["@[player]lb_old__shuofeng-turn"] = "朔风 闪",

  ["@[player]lb_old__shuofeng-round"] = "朔风 杀",
  ["#lb_old__shuofeng-xuan"] = "朔风：你可以令一名角色选择本回合不能使用【闪】或本轮不能使用【杀】",
  ["#lb_old__shuofeng"] = "朔风：你可以重铸一张【闪】",
  ["#lb_old__shuofeng-ask"] = "朔风：你可以令你本回合不能使用【闪】且 %src 可以重铸【闪】，或取消后你本轮不能使用【杀】",

  ["$lb_old__shuofeng1"] = "我无意挑起争端。",
  ["$lb_old__shuofeng2"] = "争斗…并无意义。",
}

skel:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and player.phase == Player.Start
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local ps = room:askToChoosePlayers(player, {
      targets = room:getAlivePlayers(),
      min_num = 1,
      max_num = 1,
      skill_name = skel.name,
      prompt = "#lb_old__shuofeng-xuan",
    })
    if #ps > 0 then
      event:setCostData(self, { tos = ps })
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local t = event:getCostData(self).tos[1]
    if room:askToSkillInvoke(t, {
          skill_name = skel.name,
          prompt = "#lb_old__shuofeng-ask:" .. player.id
        }) then
      room:addTableMarkIfNeed(player, "@[player]lb_old__shuofeng-turn", t.id)
    else
      room:addTableMarkIfNeed(player, "@[player]lb_old__shuofeng-round", t.id)
    end
  end,
})

skel:addEffect("active", {
  prompt = "#lb_old__shuofeng",
  anim_type = "drawcard",
  min_card_num = 1,
  target_filter = Util.FalseFunc,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).trueName == "jink"
  end,
  can_use = function(self, player)
    return #player:getTableMark("@[player]lb_old__shuofeng-turn") > 0 and not player:isKongcheng()
  end,
  on_use = function(self, room, effect)
    room:recastCard(effect.cards, effect.from, skel.name)
  end,
})

skel:addEffect("prohibit", {
  prohibit_use = function(self, player, card)
    for _, to in ipairs(Fk:currentRoom().alive_players) do
      if to:hasSkill(skel.name) then
        if (table.contains(to:getTableMark("@[player]lb_old__shuofeng-turn"), player.id) and card.trueName == "jink")
        or (table.contains(to:getTableMark("@[player]lb_old__shuofeng-round"), player.id) and card.trueName == "slash") then
          return true
        end
      end
    end
  end,
})

return skel
